package com.bobbygu.server.simpleapp.mapper;

import com.bobbygu.server.simpleapp.model.HomeAdImgModel;
import com.bobbygu.server.simpleapp.model.UserModel;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

public interface HomeMapper {
    @Select("select * from home_ad_list where name = #{name}")
    HomeAdImgModel findImgByName(String name);

    @Select("select * from home_ad_list")
    ArrayList<HomeAdImgModel> selectAll();

    @Update("update home_ad_list set imgurl=#{imgurl},img_data=#{img_data} where name=#{name}")
    void updateImg(@Param("name") String name, @Param("imgurl") String imgUrl, @Param("img_data") byte[] imgData);

    @Insert("insert into home_ad_list(name,imgurl,img_data) values(#{name},#{imgurl},#{img_data})")
    void insertImg(@Param("name") String name, @Param("imgurl") String imgUrl, @Param("img_data") byte[] imgData);

    @Delete("delete from home_ad_list where name=#{name}")
    void deleteImgByName(@Param("name") String name);
}
